<?php

namespace App\Services;

use App\Models\Mini\ComplainsModel;
use App\Models\Mini\MaintainModel;

class ComplainsService extends BaseService
{
    protected $user;

    public function __construct()
    {
        $this->user = auth('user')->user();
    }

    /**
     * Notes: 添加投诉建议
     * User: lstink
     * Date: 2021/3/5
     * Time: 11:33 上午
     * @param $data
     * @return array
     */
    public function addComplains($data): array
    {
        $data['user_id'] = $this->user['id'];
        $data['c_id'] = $this->user['community_id'];
        $data['e_id'] = $this->user['property_id'];
        $data['created_at'] = time();
        $result = ComplainsModel::create($data);
        return $result ? $this->format($result) : $this->format_error($result);
    }

}
